From: Georges Basile Stavracas Neto Date: Tue, 23 Jun 2020 13:33:22 +0000 (-0300) Subject: appDisplay: Restore dragged item's position on drag cancel X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~108 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=701d110493ec0f6079087aad1b86259f6192abff;p=gnome-shell.git appDisplay: Restore dragged item's position on drag cancel Otherwise we end up with the grid in an inconsistent state. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 5c5e70c98..5eff0c3b9 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -685,6 +685,7 @@ class AppDisplay extends BaseAppView { Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this)); Main.overview.connect('item-drag-end', this._onDragEnd.bind(this)); + Main.overview.connect('item-drag-cancelled', this._onDragCancelled.bind(this)); this.connect('destroy', this._onDestroy.bind(this)); @@ -1073,6 +1074,17 @@ class AppDisplay extends BaseAppView { this._resetOvershoot(); } + _onDragCancelled(_overview, source) { + const view = _getViewFromIcon(source); + + if (view instanceof FolderView) + return; + + // At this point, the positions aren't stored yet, thus _redisplay() + // will move all items to their original positions + this._redisplay(); + } + _canAccept(source) { return source instanceof AppViewItem; }